package com.lovo.project2.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lovo.project2.bean.LogBean;
import com.lovo.project2.mapper.ILogBeanMapper;
import com.lovo.project2.service.ILogBeanService;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
@Service
public class LogBeanServiceImpl extends ServiceImpl<ILogBeanMapper, LogBean> implements ILogBeanService {
    @Override
    public IPage<LogBean> queryAllPage(IPage iPage) {

        ;

        return baseMapper.selectPage(iPage, null);
    }

    @Override
    public IPage<LogBean> queryLogBeanListBytime(IPage iPage, LocalDate stateTime, LocalDate endTime) {
        QueryWrapper queryWrapper = new QueryWrapper();

        if (stateTime != null && !"".equals(stateTime)) {
            queryWrapper.ge("logtime", stateTime);
        }
        if (endTime != null && !"".equals(endTime)) {
            queryWrapper.le("logtime", endTime);
        }

        return baseMapper.selectPage(iPage, queryWrapper);
    }
}
